<template>
  <el-dialog title="拒绝退款" :visible.sync="dialogVisible" width="500px">
    <!-- <div class="title">您确定要拒绝退款吗？</div> -->
    <el-form :model="form">
      <!-- <el-form-item label="原因：" :label-width="formLabelWidth">
        <el-select v-model="form.refuse_reason" placeholder="请选择" @change="changeSelect">
          <el-option label="无法退款" :value="1"></el-option>
          <el-option label="其他" :value="2"></el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="原因：" :label-width="formLabelWidth">
        <el-input v-model="form.refuse_reason" type="textarea" autocomplete="off" :rows="3" placeholder="请输入拒绝退款原因" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="submit_refuse">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { adminCheckRefuse } from '@/api/orderRefund'
export default {
  // props: ['refundId'],
  props: {
    refundId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      dialogVisible: false,
      formLabelWidth: '120px',
      form: {
        refuse_reason: ''
      }
    }
  },
  methods: {
    close() {
      this.dialogVisible = false
      this.form = {
        refuse_reason: ''
      }
    },
    submit_refuse() {
      if (!this.form.refuse_reason) {
        this.$message.warning('拒绝原因不能为空')
        return false
      }
      let obj = {
        refund_id: this.refundId,
        refuse_reason: this.form.refuse_reason
      }
      adminCheckRefuse(obj).then(res => {
        this.close()
        this.$parent.getList()
      })
    }
  },
  mounted() { }
}
</script>

<style lang="scss" scoped>
.title {
  text-align: center;
  margin: 30px 0 20px;
}
</style>
